#pragma once

#include "ModelessDialog.h"

// ChartPointsDlg dialog

class ChartPointsDlg : public CModelessDialog, public L_Observer
{
	DECLARE_DYNAMIC(ChartPointsDlg)

public:
	ChartPointsDlg(CWnd* pParent = NULL);   // standard constructor
	virtual ~ChartPointsDlg();

	virtual BOOL Create(CWnd *pParentWnd = CWnd::FromHandle(L_GetMainWnd()));

// Dialog Data
	enum { IDD = IDD_CHARTPOINTSDLG };

protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

	DECLARE_MESSAGE_MAP()

//L_Observer
public:
	virtual void HandleMessage(L_Message const *pMsg);

private:
	//Controls
	CEdit m_SymbolEdit;
	CListCtrl m_ChartPointsListCtrl;

	//helpers
	void ResizeControls();
	void InsertInitialChart();
	void InsertChartPoint(int row, time_t time, double open, double high, double low, double close, long long volume);
	void SetSymbol(const char *symbol);

	//data
	L_Summary *summary;

	//optoins
	bool m_Linked;

public:
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	afx_msg void OnSize(UINT nType, int cx, int cy);
	afx_msg void OnFileLink();
};
